<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<%@ include file="/WEB-INF/views/include/header.jsp"%>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" >
				<i class="fa fa-plus"></i> 添加
			</a>
			<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" >
				<i class="fa fa-remove"></i> 删除
			</a>
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <%@ include file="/WEB-INF/views/include/footer.jsp"%>
    <script th:inline="javascript">
        var editFlag =  1;
        var removeFlag =  1;
        var prefix = ctx + "cms/cmsAttribute";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "文档属性",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'attrId', 
					title : 'id' 
				},
				{
					field : 'siteId', 
					title : '站点编码' 
				},
				{
					field : 'attrCode', 
					title : '属性编码' 
				},
				{
					field : 'attrName', 
					title : '属性名称' 
				},
				{
					field : 'imageHeight', 
					title : '图片高度' 
				},
				{
					field : 'imageWidth', 
					title : '图片宽度' 
				},
				{
					field : 'attrSeq', 
					title : '排序' 
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.attrId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.attrId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>